***** OPEN OUTPUT LOG FILE FOR APPENDIX C ANALYSES: "HARDIWRING MUTUAL COMMITTMENT" *****


*log "C:\Users\gk57526\Dropbox\Confirmation Dynamics Project (Jason Byers)\Appointee Tenure Project\Jason Byers\March 2023\DART (PRQ)\Output\Hardwiring Committment.APPENDIX C.04-21-2023.smcl" 

log using "C:\Users\Jason\Dropbox\Jason Byers\Co-Authored Projects\Projects with George Krause\Krause Projects\Confirmation Dynamics Project\Appointee Tenure Project\Jason Byers\March 2023\DART (PRQ)\Output\Hardwiring Committment.APPENDIX C.04-21-2023.smcl", replace








**** APPENDIX C STATISTICAL ANALYSES: INCLUSION OF POST-SELECTION/NOMINATION CHANGES TO AGENCY AGENDA STATUS INTERACTION WITH PRESIDENTIAL LOYALTY COVARIATE ****





** RETRIEVE SINGLE EVENT RECORDS DATABASE [N = 860 APPOINTEE OBSERVATIONS: 831 UNCENSORED OBSERVATIONS; 29 CENSORED OBSERVATIONS] **

use "C:\Users\Jason\Dropbox\Jason Byers\Co-Authored Projects\Projects with George Krause\Krause Projects\Confirmation Dynamics Project\Appointee Tenure Project\Jason Byers\March 2023\DART (PRQ)\Data\Krause and Byers.SRD.06-03-2022.dta", replace


*
*


** GENERATE CENSORING VARIABLE FOR HOLDOVER APPOINTEES SERVING BETWEEN/ACROSS ADMINISTRATIONS [=1]; UNCENSRED OBSERVATIONS [=0] ** 

gen singleadmin_service=1 if holdover==0
*
replace singleadmin_service=0 if holdover==1
*
*
tab singleadmin_service


** SET FOR SURVIVAL DATA WITH A SINGLE RECORD PER APPOINTEE OBSERVATION [N = 860: UNCENSORED N = 831; CENSORED N = 29] ** 
stset okapptdur, failure(singleadmin_service)

*
*
*

** ESTIMATE COX SEMIPARAMETRIC AND WEIBULL PARAMETRIC MODELS PRESENTED IN MANUSCRIPT [TABLE 1: MODELS 1 - 4] ** 

** NOTE COVARIATES THAT VARY TRHOUGH TIME ARE BASED ON THE STARTING DATE OF APPOINTED SERVICE [I.E., "OKSTART....""]




*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************






*** COMPUTE TAB ON FULL SAMPLE OF N = 860 TO EVALUATE COMMONALITY OF SHORT TENURES ***

tab okapptdur

*
*
*

*** COMPUTE TAB ON TRUNCATED SAMPLE EXCLUDING LAST TWO YEARS OF EACH PRESIDENTIAL TERM: N = 610 [70.93% OF FULL SAMPLE] TO EVALUATE COMMONALITY OF SHORT TENURES ***

tab okapptdur if okstartadyr==1 | okstartadyr==2 | okstartadyr==5 | okstartadyr==6

*
*
*
*

**** SHOW DIFFERENCES BETWEEN HIGH LOYALISTS WITH A MUTUAL POLICY COMMITTMENT [highloyalpp==1, n=236] AND HIGH LOYALISTS THAT DO NOT [highloyalpp==0, n=100]: where HIGH LOYALISTS ARE DEFINED AS "zloyalmedian>=0" [LIES BETWEEN MEDIAN = -0.1646416 & MEAN = 0.1284699: 61st Percentile] ***

sum zloyalmedian, detail



*
gen highloyalpp = 1 if zloyalmedian>=0 & soubinaryagency2nom==1
*
replace highloyalpp = 0 if zloyalmedian>=0 & soubinaryagency2nom==0




*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************




*** APPENDIX C SURVIVAL REGRESSION ANALYSES: COX SEMIPARAMETRIC & WEIBULL PARAMETRIC MODELS [INCLUSION OF POST-SELECTION/NOMINATION CHANGES TO AGENCY AGENDA STATUS INTERACTION WITH PRESIDENTIAL LOYALTY COVARIATE] ****




******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************




**** APPENDIX C SURVIVAL REGRESSION MODELS  ***


** SET FOR SURVIVAL DATA WITH A SINGLE RECORD PER APPOINTEE OBSERVATION [N = 860: UNCENSORED N = 831; CENSORED N = 29] ** 
stset okapptdur, failure(singleadmin_service)



**** MODEL C1: COX MODEL [OMISSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

stcox   c.zloyalmedian##i.soubinaryagency2nom   c.zloyalmedian##i.soubinaryagency2onoff  c.zloyalmedian##i.soubinaryagency2offon   zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign  okstartsenpolarizationmean okstartfilipresdistance   okcrossover okstartpresapp  okstartunemployment  i.okstartadyr  ,  hr vce(cluster sbagency)
*
estat ic

estimates store modelC1


*** COMPUTE Figure C2: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {PP − NPP Difference} {{4 [CM1−CM4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE: IQR = 1.3653231 [0.9692858 - (-0.3960373)]




** ONE INTERQUARTILE RANGE MARGINAL EFFECT INCREASE IN APPOINTEE LOYALTY DIFFERENTIAL BETWEEN POLICY PRIORITY AGENCY VERSUS NON-POLICY PRIORITY AGENCY [FIGURE 2] **


lincomest 1.soubinaryagency2nom#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC1zloyalnom = r(table)
mat list modelC1zloyalnom
*

estimates restore modelC1

lincomest 1.soubinaryagency2onoff#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC1zloyalonoff = r(table)
mat list modelC1zloyalonoff
*

estimates restore modelC1

lincomest 1.soubinaryagency2offon#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC1zloyaloffon = r(table)
mat list modelC1zloyaloffon




*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************



**** MODEL C2: COX MODEL [INCLUSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

stcox   c.zloyalmedian##i.soubinaryagency2nom   c.zloyalmedian##i.soubinaryagency2onoff  c.zloyalmedian##i.soubinaryagency2offon   zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign  okstartsenpolarizationmean okstartfilipresdistance   okcrossover okstartpresapp  okstartunemployment  i.okstartadyr  i.sbagency reagan bush41 clinton bush43,  hr vce(cluster sbagency)
*
estat ic

estimates store modelC2


*** COMPUTE Figure C2: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {PP − NPP Difference} {{4 [CM1−CM4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE: IQR = 1.3653231 [0.9692858 - (-0.3960373)]


lincomest 1.soubinaryagency2nom#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC2zloyalnom = r(table)
mat list modelC2zloyalnom
*

estimates restore modelC2

lincomest 1.soubinaryagency2onoff#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC2zloyalonoff = r(table)
mat list modelC2zloyalonoff
*

estimates restore modelC1

lincomest 1.soubinaryagency2offon#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC2zloyaloffon = r(table)
mat list modelC2zloyaloffon






*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************




**** MODEL C3: WEIBULL MODEL [OMISSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

streg   c.zloyalmedian##i.soubinaryagency2nom   c.zloyalmedian##i.soubinaryagency2onoff  c.zloyalmedian##i.soubinaryagency2offon    zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign  okstartsenpolarizationmean okstartfilipresdistance   okcrossover okstartpresapp okstartunemployment  i.okstartadyr,   distribution(weibull)  hr vce(cluster sbagency)
*
estat ic

estimates store modelC3


*** COMPUTE Figure C2: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {PP − NPP Difference} {{4 [CM1−CM4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE: IQR = 1.3653231 [0.9692858 - (-0.3960373)]


lincomest 1.soubinaryagency2nom#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC3zloyalnom = r(table)
mat list modelC3zloyalnom
*
*

estimates restore modelC3

lincomest 1.soubinaryagency2onoff#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC3zloyalonoff = r(table)
mat list modelC3zloyalonoff
*
*

estimates restore modelC3

lincomest 1.soubinaryagency2offon#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC3zloyaloffon = r(table)
mat list modelC3zloyaloffon





**** COMPUTE Figure C3: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the MEDIAN NUMBER OF DAYS OF APPOINTEE TENURE {PP − NPP Difference} {{4 [CM1−CM4] × 1 Horizontal Point Estimates and 95% CIs}.
** NOTE: IQR = 1.3653231 [0.9692858 - (-0.3960373)]

** Generate 'manual' interaction variables ** 

generate loyalppdiffnom = soubinaryagency2nom*zloyalmedian
*
generate loyalppdiffonoff = soubinaryagency2onoff*zloyalmedian
*
generate loyalppdiffoffon = soubinaryagency2offon*zloyalmedian




** Re-Estimate Model C3  with 'manual' interaction variable **

streg   zloyalmedian soubinaryagency2nom soubinaryagency2onoff soubinaryagency2offon loyalppdiffnom  loyalppdiffonoff loyalppdiffoffon  zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign  okstartsenpolarizationmean okstartfilipresdistance   okcrossover okstartpresapp okstartunemployment  i.okstartadyr, distribution(weibull) hr vce(cluster sbagency)

estimate store modelC3a




** Generate Differential Predicted Median Survival Time of Senate Committee Stage of Confirmation Process -- Based on Interquartile Differential [corresponding to Differential Marginal Hazard Ratio Estimates] **

*Interquartile range

margins, predict(median time) at(loyalppdiffnom=(-0.3960373 0.9692858))  contrast(atcontrast(r))
matrix modelC3azloyalnom = r(table)
mat list modelC3azloyalnom
*
*
margins, predict(median time) at(loyalppdiffonoff=(-0.3960373 0.9692858))  contrast(atcontrast(r))
matrix modelC3azloyalonoff = r(table)
mat list modelC3azloyalonoff
*
*
margins, predict(median time) at(loyalppdiffoffon=(-0.3960373 0.9692858))  contrast(atcontrast(r))
matrix modelC3azloyaloffon = r(table)
mat list modelC3azloyaloffon



*Interdecile range

estimates restore modelC3a

margins, predict(median time) at(loyalppdiffnom=(-0.6451644 1.711348))
margins, predict(median time) at(loyalppdiffnom=(-0.6451644 1.711348))  contrast(atcontrast(r))

matrix modelC3bzloyalnom = r(table)
mat list modelC3bzloyalnom

*
*

margins, predict(median time) at(loyalppdiffonoff=(-0.6451644 1.711348))
margins, predict(median time) at(loyalppdiffonoff=(-0.6451644 1.711348))  contrast(atcontrast(r))

matrix modelC3bzloyalonoff = r(table)
mat list modelC3bzloyalonoff

*
*

margins, predict(median time) at(loyalppdiffoffon=(-0.6451644 1.711348))
margins, predict(median time) at(loyalppdiffoffon=(-0.6451644 1.711348))  contrast(atcontrast(r))

matrix modelC3bzloyaloffon = r(table)
mat list modelC3bzloyaloffon





******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************



**** MODEL C4: WEIBULL MODEL [INCLUSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

streg   c.zloyalmedian##i.soubinaryagency2nom   c.zloyalmedian##i.soubinaryagency2onoff  c.zloyalmedian##i.soubinaryagency2offon   zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign  okstartsenpolarizationmean okstartfilipresdistance   okcrossover okstartpresapp okstartunemployment  i.okstartadyr  i.sbagency reagan bush41 clinton bush43, distribution(weibull) hr vce(cluster sbagency)
*
estat ic

estimates store modelC4



*** COMPUTE Figure C2: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {PP − NPP Difference} {{4 [CM1−CM4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE: IQR = 1.3653231 [0.9692858 - (-0.3960373)]


lincomest 1.soubinaryagency2nom#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC4zloyalnom = r(table)
mat list modelC4zloyalnom
*
*

estimates restore modelC4

lincomest 1.soubinaryagency2onoff#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC4zloyalonoff = r(table)
mat list modelC4zloyalonoff
*
*

estimates restore modelC4

lincomest 1.soubinaryagency2offon#c.zloyalmedian*1.3653231, eform(hr)
matrix modelC4zloyaloffon = r(table)
mat list modelC4zloyaloffon




**** COMPUTE Figure C3: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the MEDIAN NUMBER OF DAYS OF APPOINTEE TENURE {PP − NPP Difference} {{4 [CM1−CM4] × 1 Horizontal Point Estimates and 95% CIs}.
** NOTE: IQR = 1.3653231 [0.9692858 - (-0.3960373)]

** Re-Estimate Model C4  with 'manual' interaction variable **
streg   zloyalmedian soubinaryagency2nom soubinaryagency2onoff soubinaryagency2offon loyalppdiffnom  loyalppdiffonoff loyalppdiffoffon   zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign  okstartsenpolarizationmean okstartfilipresdistance   okcrossover okstartpresapp okstartunemployment  i.okstartadyr i.sbagency reagan bush41 clinton bush43, distribution(weibull) hr vce(cluster sbagency)

estimates store modelC4a



** Generate Differential Predicted Median Survival Time of Senate Committee Stage of Confirmation Process -- Based on Interquartile Differential [corresponding to Differential Marginal Hazard Ratio Estimates] **

*Interquartile range

margins, predict(median time) at(loyalppdiffnom=(-0.3960373 0.9692858))  contrast(atcontrast(r))

matrix modelC4azloyalnom = r(table)
mat list modelC4azloyalnom

*
*

margins, predict(median time) at(loyalppdiffonoff=(-0.3960373 0.9692858))  contrast(atcontrast(r))
matrix modelC4azloyalonoff = r(table)
mat list modelC4azloyalonoff
*
*
margins, predict(median time) at(loyalppdiffoffon=(-0.3960373 0.9692858))  contrast(atcontrast(r))
matrix modelC4azloyaloffon = r(table)
mat list modelC4azloyaloffon

*
*
*

*Interdecile range

estimates restore modelC4a

margins, predict(median time) at(loyalppdiffnom=(-0.6451644 1.711348))
margins, predict(median time) at(loyalppdiffnom=(-0.6451644 1.711348))  contrast(atcontrast(r))

matrix modelC4bzloyalnom = r(table)
mat list modelC4bzloyalnom


margins, predict(median time) at(loyalppdiffonoff=(-0.6451644 1.711348))
margins, predict(median time) at(loyalppdiffonoff=(-0.6451644 1.711348))  contrast(atcontrast(r))

matrix modelC4bzloyalonoff = r(table)
mat list modelC4bzloyalonoff


margins, predict(median time) at(loyalppdiffoffon=(-0.6451644 1.711348))
margins, predict(median time) at(loyalppdiffoffon=(-0.6451644 1.711348))  contrast(atcontrast(r))

matrix modelC4bzloyaloffon = r(table)
mat list modelC4bzloyaloffon


*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************





**** ALTERNATIVE DATABASE ANALYSIS OF REPORTED MODELS [C1-C4]: MULTIPLE SPELLS/RECORDS DATA [COX & WEIBULL MODELS]  ***


use "C:\Users\Jason\Dropbox\Jason Byers\Co-Authored Projects\Projects with George Krause\Krause Projects\Confirmation Dynamics Project\Appointee Tenure Project\Jason Byers\March 2023\DART (PRQ)\Data\Krause and Byers.MRD.06-03-2022.dta", replace


*
*


** GENERATE CENSORING VARIABLE FOR HOLDOVER APPOINTEES SERVING BETWEEN/ACROSS ADMINISTRATIONS [=1]; UNCENSRED OBSERVATIONS [=0] ** 

gen singleadmin_service=1 if holdover==0
*
replace singleadmin_service=0 if holdover==1
*
*
tab singleadmin_service



** SET DATABASE WITH MULTIPLE SPELLS FOR EACH APPOINTEE OBSERVATION [ID(OBSIDENT)]; "DEPART" IS A FAILURE BINARY VARIABLE: A SINGLE "1" PER APPOINTEE OBSERVATION, N = 860 [UNCENSORED N = 831; CENSORED N = 29] ** 
stset okapptdur, failure(singleadmin_service)  id(obsident)





**** MODEL C5: COX MODEL [OMISSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

stcox   c.zloyalmedian##i.soubinaryagency2onpanel  zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign abssenpartydiffmean absfilipresdistancey okcrossover avgpresapp  unemployment i. okstartadyr ,  hr vce(cluster sbagency)
*
estat ic


*** COMPUTE Figure C1: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {STANDALONE − NON-STANDALONE Difference} {{2 [M2 & M4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE: IQ = 1.3688693 [0.9781515 - (-0.3907178)]

lincomest 1.soubinaryagency2onpanel#c.zloyalmedian*1.3688693, eform(hr)
matrix modelC5zloyal = r(table)
mat list modelC5zloyal





**** MODEL C6: COX MODEL [INCLUSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

stcox   c.zloyalmedian##i.soubinaryagency2onpanel  zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign abssenpartydiffmean absfilipresdistancey okcrossover avgpresapp  unemployment i. okstartadyr i.sbagency reagan bush41 clinton bush43,  hr vce(cluster sbagency)
*
estat ic


*** COMPUTE Figure C1: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {STANDALONE − NON-STANDALONE Difference} {{2 [M2 & M4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE: IQ = 1.3688693 [0.9781515 - (-0.3907178)]

lincomest 1.soubinaryagency2onpanel#c.zloyalmedian*1.3688693, eform(hr)
matrix modelC6zloyal = r(table)
mat list modelC6zloyal






**** MODEL C7: WEIBULL MODEL [OMISSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

streg  c.zloyalmedian##i.soubinaryagency2onpanel  zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign abssenpartydiffmean absfilipresdistancey okcrossover avgpresapp  unemployment i. okstartadyr, distribution(weibull) hr vce(cluster sbagency)
*
estat ic



*** COMPUTE Figure C1: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {STANDALONE − NON-STANDALONE Difference} {{2 [M2 & M4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE:  IQ = 1.3688693 [0.9781515 - (-0.3907178)]

lincomest 1.soubinaryagency2onpanel#c.zloyalmedian*1.3688693, eform(hr)
matrix modelC7zloyal = r(table)
mat list modelC7zloyal



**** COMPUTE Figure C2: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the MEDIAN NUMBER OF DAYS OF APPOINTEE TENURE {PP − NPP Difference} {{4 [M1−M4] × 1 Horizontal Point Estimates and 95% CIs}.
**  NOTE: IQ = 1.3688693 [0.9781515 - (-0.3907178)] **

*drop loyalppdiff
generate loyalppdiffonpanel = soubinaryagency2onpanel*zloyalmedian

** Re-Estimate Model C7  with 'manual' interaction variable **
streg   zloyalmedian soubinaryagency2onpanel loyalppdiffonpanel  zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign abssenpartydiffmean absfilipresdistancey okcrossover avgpresapp  unemployment i. okstartadyr, distribution(weibull) hr vce(cluster sbagency)

estimates store modelc71

*margins, predict(median time) at(loyalppdiff=(-0.3960373 0.9710589))

** Generate Differential Predicted Median Survival Time of Senate Committee Stage of Confirmation Process -- Based on Interquartile Differential [corresponding to Differential Marginal Hazard Ratio Estimates] **

margins, predict(median time) at(loyalppdiffonpanel=(-0.3960373 0.9710589))  contrast(atcontrast(r))

matrix modelC71azloyal = r(table)
mat list modelC71azloyal



estimates restore modelc71

margins, predict(median time) at(loyalppdiffonpanel=(-.6531436 1.756563))
margins, predict(median time) at(loyalppdiffonpanel=(-.6531436 1.756563))  contrast(atcontrast(r))

matrix modelC71bzloyal = r(table)
mat list modelC71bzloyal







**** MODEL C8: WEIBULL MODEL [INCLUSION OF BOTH AGENCY AND PRESIDENTIAL ADMINISTRATION FIXED EFFECTS: CLUSTER-ADJUSTED STANDARD ERRORS BY AGENCY] ****

streg  c.zloyalmedian##i.soubinaryagency2onpanel  zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign abssenpartydiffmean absfilipresdistancey okcrossover avgpresapp  unemployment i. okstartadyr  i.sbagency reagan bush41 clinton bush43, distribution(weibull) hr vce(cluster sbagency)
*
estat ic



*** COMPUTE Figure C1: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the HAZARD RATIO of APPOINTEE TENURE {STANDALONE − NON-STANDALONE Difference} {{2 [M2 & M4] × 1 Horizontal Point Estimates and 95% CIs}}. ****
** NOTE:  IQ = 1.3688693 [0.9781515 - (-0.3907178)]

lincomest 1.soubinaryagency2onpanel#c.zloyalmedian*1.3688693, eform(hr)
matrix modelC8zloyal = r(table)
mat list modelC8zloyal



**** COMPUTE Figure C2: Interquartile Increase Marginal Effect Change of Appointee Loyalty on the MEDIAN NUMBER OF DAYS OF APPOINTEE TENURE {PP − NPP Difference} {{4 [M1−M4] × 1 Horizontal Point Estimates and 95% CIs}.
**  NOTE: IQ = 1.3688693 [0.9781515 - (-0.3907178)] **

drop loyalppdiffonpanel
generate loyalppdiffonpanel = soubinaryagency2onpanel*zloyalmedian

** Re-Estimate Model C8  with 'manual' interaction variable **
streg   zloyalmedian soubinaryagency2onpanel loyalppdiffonpanel  zpecompmedian  zmecompmedian   toplevel2   presagencyideolalign  presagencyideolopposed subagencydesign standaloneagencydesign abssenpartydiffmean absfilipresdistancey okcrossover avgpresapp  unemployment i. okstartadyr  i.sbagency reagan bush41 clinton bush43, distribution(weibull) hr vce(cluster sbagency)

estimates store modelc81

*margins, predict(median time) at(loyalppdiff=(-0.3960373 0.9710589))

** Generate Differential Predicted Median Survival Time of Senate Committee Stage of Confirmation Process -- Based on Interquartile Differential [corresponding to Differential Marginal Hazard Ratio Estimates] **

margins, predict(median time) at(loyalppdiffonpanel=(-0.3960373 0.9710589))  contrast(atcontrast(r))

matrix modelC81azloyal = r(table)
mat list modelC81azloyal



estimates restore modelc81

margins, predict(median time) at(loyalppdiffonpanel=(-.6531436 1.756563))
margins, predict(median time) at(loyalppdiffonpanel=(-.6531436 1.756563))  contrast(atcontrast(r))

matrix modelC81bzloyal = r(table)
mat list modelC81bzloyal







******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************



*Figure 1

matrix A = J(4, 3, .)
matrix coln A = Point ll95 ul95
matrix rown A = 1 2 3 4


matrix A[1,1] = modelC1zloyalnom[1,1]
matrix A[1,2] = modelC1zloyalnom[5,1]
matrix A[1,3] = modelC1zloyalnom[6,1]


matrix A[2,1] = modelC2zloyalnom[1,1]
matrix A[2,2] = modelC2zloyalnom[5,1]
matrix A[2,3] = modelC2zloyalnom[6,1]


matrix A[3,1] = modelC3zloyalnom[1,1]
matrix A[3,2] = modelC3zloyalnom[5,1]
matrix A[3,3] = modelC3zloyalnom[6,1]


matrix A[4,1] = modelC4zloyalnom[1,1]
matrix A[4,2] = modelC4zloyalnom[5,1]
matrix A[4,3] = modelC4zloyalnom[6,1]





********************

matrix B = J(4, 3, .)
matrix coln B = Point ll95 ul95
matrix rown B = 1 2 3 4


matrix B[1,1] = modelC1zloyalonoff[1,1]
matrix B[1,2] = modelC1zloyalonoff[5,1]
matrix B[1,3] = modelC1zloyalonoff[6,1]



matrix B[2,1] = modelC2zloyalonoff[1,1]
matrix B[2,2] = modelC2zloyalonoff[5,1]
matrix B[2,3] = modelC2zloyalonoff[6,1]



matrix B[3,1] = modelC3zloyalonoff[1,1]
matrix B[3,2] = modelC3zloyalonoff[5,1]
matrix B[3,3] = modelC3zloyalonoff[6,1]



matrix B[4,1] = modelC4zloyalonoff[1,1]
matrix B[4,2] = modelC4zloyalonoff[5,1]
matrix B[4,3] = modelC4zloyalonoff[6,1]




********************

matrix C = J(4, 3, .)
matrix coln C = Point ll95 ul95
matrix rown C = 1 2 3 4


matrix C[1,1] = modelC1zloyaloffon[1,1]
matrix C[1,2] = modelC1zloyaloffon[5,1]
matrix C[1,3] = modelC1zloyaloffon[6,1]



matrix C[2,1] = modelC2zloyaloffon[1,1]
matrix C[2,2] = modelC2zloyaloffon[5,1]
matrix C[2,3] = modelC2zloyaloffon[6,1]



matrix C[3,1] = modelC3zloyaloffon[1,1]
matrix C[3,2] = modelC3zloyaloffon[5,1]
matrix C[3,3] = modelC3zloyaloffon[6,1]



matrix C[4,1] = modelC4zloyaloffon[1,1]
matrix C[4,2] = modelC4zloyaloffon[5,1]
matrix C[4,3] = modelC4zloyaloffon[6,1]



********************

matrix D = J(4, 3, .)
matrix coln D = Point ll95 ul95
matrix rown D = 1 2 3 4

matrix D[1,1] = modelC5zloyal[1,1]
matrix D[1,2] = modelC5zloyal[5,1]
matrix D[1,3] = modelC5zloyal[6,1]


matrix D[2,1] = modelC6zloyal[1,1]
matrix D[2,2] = modelC6zloyal[5,1]
matrix D[2,3] = modelC6zloyal[6,1]


matrix D[3,1] = modelC7zloyal[1,1]
matrix D[3,2] = modelC7zloyal[5,1]
matrix D[3,3] = modelC7zloyal[6,1]


matrix D[4,1] = modelC8zloyal[1,1]
matrix D[4,2] = modelC8zloyal[5,1]
matrix D[4,3] = modelC8zloyal[6,1]



coefplot (matrix(A[,1]), mcolor(black) ci((2 3)) ciopts(lpattern(solid) lcolor(black)) label(`""Time of Nomination" "Agenda Status""')) (matrix(B[,1]), mcolor(gs6) ci((2 3)) ciopts(lpattern(dash) lcolor(gs6)) label(`""Switch from On to Off" "Agenda Status""')) (matrix(C[,1]), mcolor(gs10) ci((2 3)) ciopts(lpattern(dash) lcolor(gs10)) label(`""Switch from Off to On" "Agenda Status""')) (matrix(D[,1]), mcolor(gs14) ci((2 3)) ciopts(lpattern(dash) lcolor(gs14)) label(`""Time of Departure" "Agenda Status""')), grid(none) xline(1, lcolor(red%40) lpattern(dash)) xtitle("Hazard Ratio", size(small) margin(t=2)) ylabel(1 "Model C1" 2 "Model C2" 3 "Model C3" 4 "Model C4", labsize(small) noticks) xlabel(0(1)2, angle(0) labsize(small) format(%9.1f)) msymbol(o) mcolor(black) msize(small) title("FIGURE C1", size(small)) ciopts(lcolor(black)) legend(position(3) size(small) col(1) region(lstyle(none))) subtitle("Marginal Differential Effect of Appointee Loyalty on Appointee Tenure Hazard" "[Policy Priority Agencies versus Non-Policy Priority Agencies]", size(small))  mlabel format(%9.3f) mlabposition(12) mlabsize(vsmall)

graph save "Graph" "C:\Users\Jason\Dropbox\Jason Byers\Co-Authored Projects\Projects with George Krause\Krause Projects\Confirmation Dynamics Project\Appointee Tenure Project\Jason Byers\March 2023\DART (PRQ)\Graphics\FigureC1.gph", replace








************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************


*Figure 2

matrix E = J(4, 3, .)
matrix coln E = Point ll95 ul95
matrix rown E = 1 2 3 4 

matrix E[1,1] = modelC3azloyalnom[1,1]
matrix E[1,2] = modelC3azloyalnom[5,1]
matrix E[1,3] = modelC3azloyalnom[6,1]


matrix E[2,1] = modelC3bzloyalnom[1,1]
matrix E[2,2] = modelC3bzloyalnom[5,1]
matrix E[2,3] = modelC3bzloyalnom[6,1]


matrix E[3,1] = modelC4azloyalnom[1,1]
matrix E[3,2] = modelC4azloyalnom[5,1]
matrix E[3,3] = modelC4azloyalnom[6,1]


matrix E[4,1] = modelC4bzloyalnom[1,1]
matrix E[4,2] = modelC4bzloyalnom[5,1]
matrix E[4,3] = modelC4bzloyalnom[6,1]



********************

matrix F = J(4, 3, .)
matrix coln F = Point ll95 ul95
matrix rown F = 1 2 3 4

matrix F[1,1] = modelC3azloyalonoff[1,1]
matrix F[1,2] = modelC3azloyalonoff[5,1]
matrix F[1,3] = modelC3azloyalonoff[6,1]


matrix F[2,1] = modelC3bzloyalonoff[1,1]
matrix F[2,2] = modelC3bzloyalonoff[5,1]
matrix F[2,3] = modelC3bzloyalonoff[6,1]


matrix F[3,1] = modelC4azloyalonoff[1,1]
matrix F[3,2] = modelC4azloyalonoff[5,1]
matrix F[3,3] = modelC4azloyalonoff[6,1]


matrix F[4,1] = modelC4bzloyalonoff[1,1]
matrix F[4,2] = modelC4bzloyalonoff[5,1]
matrix F[4,3] = modelC4bzloyalonoff[6,1]


********************

matrix G = J(4, 3, .)
matrix coln G = Point ll95 ul95
matrix rown G = 1 2 3 4

matrix G[1,1] = modelC3azloyaloffon[1,1]
matrix G[1,2] = modelC3azloyaloffon[5,1]
matrix G[1,3] = modelC3azloyaloffon[6,1]


matrix G[2,1] = modelC3bzloyaloffon[1,1]
matrix G[2,2] = modelC3bzloyaloffon[5,1]
matrix G[2,3] = modelC3bzloyaloffon[6,1]


matrix G[3,1] = modelC4azloyaloffon[1,1]
matrix G[3,2] = modelC4azloyaloffon[5,1]
matrix G[3,3] = modelC4azloyaloffon[6,1]


matrix G[4,1] = modelC4bzloyaloffon[1,1]
matrix G[4,2] = modelC4bzloyaloffon[5,1]
matrix G[4,3] = modelC4bzloyaloffon[6,1]


********************

matrix H = J(4, 3, .)
matrix coln H = Point ll95 ul95
matrix rown H = 1 2 3 4

matrix H[1,1] = modelC71azloyal[1,1]
matrix H[1,2] = modelC71azloyal[5,1]
matrix H[1,3] = modelC71azloyal[6,1]


matrix H[2,1] = modelC71bzloyal[1,1]
matrix H[2,2] = modelC71bzloyal[5,1]
matrix H[2,3] = modelC71bzloyal[6,1]


matrix H[3,1] = modelC81azloyal[1,1]
matrix H[3,2] = modelC81azloyal[5,1]
matrix H[3,3] = modelC81azloyal[6,1]


matrix H[4,1] = modelC81bzloyal[1,1]
matrix H[4,2] = modelC81bzloyal[5,1]
matrix H[4,3] = modelC81bzloyal[6,1]


coefplot (matrix(E[,1]), mcolor(black) ci((2 3)) ciopts(lpattern(solid) lcolor(black)) label(`""Time of Nomination" "Agenda Status""')) (matrix(F[,1]), mcolor(gs6) ci((2 3)) ciopts(lpattern(dash) lcolor(gs6)) label(`""Switch from On to Off" "Agenda Status""')) (matrix(G[,1]), mcolor(gs10) ci((2 3)) ciopts(lpattern(dash) lcolor(gs10)) label(`""Switch from Off to On" "Agenda Status""')) (matrix(H[,1]), mcolor(gs14) ci((2 3)) ciopts(lpattern(dash) lcolor(gs14)) label(`""Time of Departure" "Agenda Status""')), grid(none) xtitle("Predicted Number of Days", size(small) margin(t=2)) ylabel(1 `" "Model C3" "Interquartile Change" "' 2 `" "Model C3" "Interdecile Change" "' 3 `" "Model C4" "Interquartile Change" "' 4 `" "Model C4" "Interdecile Change" "', labsize(vsmall) noticks) mlabel format(%9.0f) mlabposition(12) mlabsize(vsmall) xlabel(-400(100)900, angle(0) labsize(small) format(%9.0f))   msymbol(o) mcolor(black) msize(small) title("FIGURE C2", size(small)) ciopts(lcolor(black)) legend(position(3) size(vsmall) col(1) region(lstyle(none))) subtitle("Marginal Differential Effect of Presidential Loyalty on Median Appointee Tenure" "[Policy Priority Agencies versus Non-Policy Priority Agencies]", size(small)) xline(0, lcolor(red%40) lpattern(dash))

graph save "Graph" "C:\Users\Jason\Dropbox\Jason Byers\Co-Authored Projects\Projects with George Krause\Krause Projects\Confirmation Dynamics Project\Appointee Tenure Project\Jason Byers\March 2023\DART (PRQ)\Graphics\FigureC2.gph", replace



*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************



*** STILL NEED TO MAKE A AIC/BIC Table ***

log close

